package com.cyx.netty.gateway.config;

import io.netty.channel.nio.NioEventLoopGroup;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value = "classpath:/netty.properties")
public class NettyEventThreadConfig {

  @Value("${boss.thread.count}")
  private int bossCount;

  @Value("${worker.thread.count}")
  private int workerCount;

  @Bean(name = "bossGroup")
  public NioEventLoopGroup bossGroup(){
    return new NioEventLoopGroup(bossCount);
  }

  @Bean(name = "workerGroup")
  public NioEventLoopGroup workerGroup(){
    return new NioEventLoopGroup(workerCount);
  }

//    @Bean(name = "serverCodec")
//    public HttpServerCodec serverCodec(){
//        return new HttpServerCodec();
//    }

   /* @Bean(name = "aggregator")
    public HttpObjectAggregator aggregator(){
        return new HttpObjectAggregator(maxContentLength);
    }
*/
}
